<?php
include("include/config.inc.php");
$dataArray = '';
$selBill = "SELECT outChallenNo FROM outgoingmaster WHERE outChallenNo = ".$_GET['outChallanNo'];
$selBillRes = mysql_query($selBill);
if($bRow = mysql_fetch_array($selBillRes))
{
	if($bRow['outChallenNo'] != NULL)
	{                     
		$dataArray = array();
	  $dataArray[0] = 'Bill No. Already Exits';
	  $selMaxChallan = "SELECT MAX(outChallenNo) + 1 AS outChallanNo
		                   FROM outgoingmaster";
		$selMaxChallanRes = mysql_query($selMaxChallan);
		if($maxRow = mysql_fetch_array($selMaxChallanRes));
		{
		  if($maxRow['outChallanNo'] == NULL)
		  	$dataArray[1] = 1;
			else
			  $dataArray[1] = $maxRow['outChallanNo'];
		}
	}
}
echo Json_Encode($dataArray); 
?>